package com.acwing.partition3;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/2/12 19:31
 */
public class AC242一个简单的整数问题 {

    private static final int N = 100010;
    private static int[] a = new int[N], c = new int[N];

    private static int n = 0;

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        n = Integer.parseInt(ss[0]);
        int m = Integer.parseInt(ss[1]);
        ss = reader.readLine().split(" ");
        for (int i = 1; i <= n; i++) a[i] = Integer.parseInt(ss[i - 1]);
        //差分数组初始化树状数组
        for (int i = 1; i <= n; i++) add(i, a[i] - a[i - 1]);
        for (int i = 0; i < m; i++) {
            ss = reader.readLine().split(" ");
            if (ss[0].charAt(0) == 'Q') {
                int x = Integer.parseInt(ss[1]);
                writer.write(ask(x) + "\n");
            } else {
                int left = Integer.parseInt(ss[1]), right = Integer.parseInt(ss[2]), k = Integer.parseInt(ss[3]);
                add(left, k);
                add(right + 1, -k);
            }
        }
        writer.flush();
    }

    private static long ask(int x) {
        long res = 0;
        for (int i = x; i != 0; i -= lowbit(i)) res += c[i];
        return res;
    }

    private static void add(int x, int k) {
        for (int i = x; i <= n; i += lowbit(i)) c[i] += k;
    }

    private static int lowbit(int x) {
        return x & -x;
    }
}
